﻿
namespace ConsoleApp1

{
    internal class Program
    {
        static void Main(string[] args)
        {
            
            //接受用户输入
            var input = Console.ReadLine();
            int limit = Convert.ToInt32(input);
            //计算并计时
            DateTime start = DateTime.Now;
            int result = PrimeNumber(limit);
            TimeSpan time = DateTime.Now-start;
            //输出结果
            Console.WriteLine(result);
            Console.WriteLine(time.TotalSeconds);
        }
        //找到limit内最大质数
        public static int PrimeNumber(int limit)
        {
            int i, j;
            for (i=limit; i>0; i--)
            {
                int k = 0;
                for (j = 2; j<i; j++)
                {
                    if (i%j==0) k++;
                    if (k>0) break;
                }
                if (k==0)
                    break;
            }
            return i;
        }
    }
}